import {
  exportUrl
} from '@/api/print/mesProdOthercode'
import { getDict } from '@/api/common'
// 列表头按钮配置
export const operateList = [
  {
    name: $i18n.t('common.export'),
    type: 'primary',
    icon: 'el-icon-download',
    handleName: 'export', // 点击时返回的标识
    url: exportUrl
  }
]
// 行末按钮配置
export const rowConfig = [
  {
    name: $i18n.t('common.view'),
    type: 'primary',
    class: 'row-btn-primary',
    handleName: 'show' // 点击时返回的标识
  }
]
// 搜索条件配置
export const searchConfig = {
  inline: true,
  formDesc: {
    orderCode: {
      type: 'input',
      label: $i18n.t('mesOtherCode.orderCode')
    },
    barcode: {
      type: 'input',
      label: $i18n.t('mesOtherCode.barcode')
    },

    prodCode: {
      type: 'input',
      label: $i18n.t('mesOtherCode.prodCode')
    },
    prodName: {
      type: 'input',
      label: $i18n.t('mesOtherCode.prodName')
    },
    codeType: {
      type: 'select',
      label: $i18n.t('mesOtherCode.codeType'),
      prop: {
        value: 'value',
        text: 'description'
      },
      options: async (data) => {
        const list = await getDict('mes_code_type')
        return list.data.result
      }
    },
    planBeginDate: {
      type: 'daterange',
      label: $i18n.t('mesOtherCode.planBeginDate'),
      attrs: {
        valueFormat: 'yyyy-MM-dd',
        searchArrKey: ['planBeginDateMin', 'planBeginDateMax']
      }
    },
    barcodePrintTemp: {
      type: 'input',
      label: $i18n.t('mesOtherCode.barcodePrintTemp')
    },
    isPrint: {
      type: 'select',
      label: $i18n.t('mesOtherCode.isPrint'),
      prop: {
        value: 'value',
        text: 'description'
      },
      options: async (data) => {
        const list = await getDict('yes_or_not')
        return list.data.result
      }
    },
    isSubmitted: {
      type: 'select',
      label: $i18n.t('mesOtherCode.isSubmitted'),
      prop: {
        value: 'value',
        text: 'description'
      },
      options: async (data) => {
        const list = await getDict('yes_or_not')
        return list.data.result
      }
    }
  }
}
// 新增/删除表单配置
export const formDescDialog = {
  span: 24,
  disabled: true,
  isShowSubmitBtn: false,
  formDesc: {
    planCode: {
      type: 'input',
      label: $i18n.t('mesOtherCode.planCode'),
      layout: 12,
      required: false
    },
    barcode: {
      type: 'input',
      label: $i18n.t('mesOtherCode.barcode'),
      layout: 12,
      required: false
    },
    prodCode: {
      type: 'input',
      label: $i18n.t('mesOtherCode.prodCode'),
      layout: 12,
      required: false
    },
    prodName: {
      type: 'input',
      label: $i18n.t('mesOtherCode.prodName'),
      layout: 12,
      required: false
    },
    seriesCode: {
      type: 'input',
      label: $i18n.t('mesOtherCode.seriesCode'),
      layout: 12,
      required: false
    },
    seriesName: {
      type: 'input',
      label: $i18n.t('mesOtherCode.seriesName'),
      layout: 12,
      required: false
    },
    planBeginDate: {
      type: 'date',
      label: $i18n.t('mesOtherCode.planBeginDate'),
      layout: 12,
      required: false,
      attrs: {
        valueFormat: 'yyyy-MM-dd'
      }
    },
    planEndDate: {
      type: 'date',
      label: $i18n.t('mesOtherCode.planEndDate'),
      layout: 12,
      required: false,
      attrs: {
        valueFormat: 'yyyy-MM-dd'
      }
    },
    barcodePrintTemp: {
      type: 'input',
      label: $i18n.t('mesOtherCode.barcodePrintTemp'),
      layout: 12,
      required: false
    },
    lineCode: {
      type: 'input',
      label: $i18n.t('common.lineCode'),
      layout: 12,
      required: false
    },
    lineName: {
      type: 'input',
      label: $i18n.t('common.lineName'),
      layout: 12,
      required: false
    },
    isPrint: {
      type: 'select',
      label: $i18n.t('mesOtherCode.isPrint'),
      layout: 12,
      required: false,
      prop: {
        value: 'value',
        text: 'description'
      },
      options: async (data) => {
        const list = await getDict('yes_or_not')
        return list.data.result
      }
    },
    isSubmitted: {
      type: 'select',
      label: $i18n.t('mesOtherCode.isSubmitted'),
      layout: 12,
      required: false,
      prop: {
        value: 'value',
        text: 'description'
      },
      options: async (data) => {
        const list = await getDict('yes_or_not')
        return list.data.result
      }
    },
    remark: {
      type: 'textarea',
      label: $i18n.t('common.remark'),
      layout: 12,
      required: false
    }
  }
}
